package 算法.leetcode周赛.Test242;

/**
 * @author:谢君臣
 * @Date:2021/5/24-10:59
 * @version:1.0
 * @function:
 */
public class lc跳跃游戏 {
    public static void main(String[] args) {
    }
    public static boolean canReach(String s, int minJump, int maxJump) {
        if(s.length()<1||s.charAt(s.length()-1)!='0')
            return false;
        return cheack(new StringBuilder(s),minJump,maxJump);
    }

    private static boolean cheack(StringBuilder s, int minJump, int maxJump) {
        if (s.length()==1) return true;
        boolean flag = false;
        for (int i = Math.min(maxJump,s.length()-1); i >= minJump; i--) {
            if (s.charAt(i)=='0'&& cheack(new StringBuilder(s.toString().substring(i)), minJump, maxJump))
                return true;
        }
        return false;
    }
}
